/**点击dom返回该dom的event信息 */
const directive = {
    bind(el, binding) {
        function documentClickDom(e) {
            let domWidth = el.offsetWidth;
            let domLeft = el.offsetLeft;
            const position={
                width:domWidth,
                offsetLeft:domLeft
            }
            if(binding.expression){
                binding.value(position,e)
            }
        }
        el.__documentClickDom__=documentClickDom;
        el.addEventListener('click',documentClickDom);
    },
    unbind(el,binding){
        el.removeEventListener('click',el.__documentClickDom__);
        delete el.__documentClickDom__;
    }
}
export default directive